/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.murillo.chufa.entry;

import java.lang.ref.ReferenceQueue;

/**
 *
 * @author Elisa
 */
class SoftValueCacheEntry<K, V> extends CacheEntry<K, V> {

    private volatile K key;

    SoftValueCacheEntry(K key, V referent, ReferenceQueue queue, long creationCost, long tickStamp) {
        super(referent, queue, creationCost, tickStamp);
        this.key = key;
    }

    SoftValueCacheEntry(K key, V referent, ReferenceQueue queue, long creationCost, SoftValueCacheEntry old) {
        super(referent, queue, creationCost, old.tickStamp);
        this.hits = old.hits;
        this.key = key;
        this.one_costxhits = 1.0F / (creationCost * hits + 1);
    }
    
    @Override
    public K getKey() {
        return key;
    }

    @Override
    public void dispose() {
        this.key = null;
        this.hardValue = null;
    }
   
}
